///@file MultiIndex.h
///@brief Declaration of the class representing a MultiIndex
///@author Arnaud Duval
///@version 0.0
///@date 2010/04/14


#ifndef MULTIINDEX_H
#define MULTIINDEX_H

#include <assert.h>
#include <iostream>
#include "../../mathobject/include/Vector.h"


///@class MultiIndex
///@brief Class defining a MultiIndex
///A MultiIndex is an array of indexes
class MultiIndex
{
	private:
		///@brief Array of vectors
		int *a;
		///@brief Cardinality of multi-index
		unsigned int card;
	public:
		///@brief Default constructor
		MultiIndex();
		///@brief Constructor with given size
		MultiIndex(int);
		///@brief Copy constructor
		MultiIndex(const MultiIndex &);
		///@brief Copy constructor for temporary object
		MultiIndex(MultiIndex*);
		///@brief Destructor
		~MultiIndex();
		///@brief Overload of = operator
		MultiIndex& operator=(const MultiIndex &);
		///@brief Overload of = operator for temporary object
		MultiIndex& operator=(MultiIndex*);
		///@brief Overload of &= operator : copy without size check
		MultiIndex& operator&=(const MultiIndex &);
		///@brief Overload of [] operator
		int& operator[](unsigned int) const;
		///@brief Swaptwo components
		void Swap(unsigned int, unsigned int);
		///@brief Sort values using Bubble sort algorithm
		void BubbleSort();
		///@brief Return q-norm of MultiIndex
		double qNorm(double);
		///@brief Return qw-norm of MultiIndex
		double qwNorm(double, Vector);
		///@brief Return cardinality of MultiIndex
		unsigned int Cardinality();

		///@brief Overload of << operator
		friend std::ostream& operator<<(std::ostream &, const MultiIndex&);
		///@brief Overload of == operator
		friend bool operator==(const MultiIndex&, const MultiIndex&);
		
};

#endif